package com.apes.crm.car.model;


import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.scm.masterdata.area.model.Area;
import com.apes.scm.masterdata.product.model.Classify;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * 功能：车型服务限制
 *
 * @author zhuyh
 * @time 14:46
 * @date 2020/1/7
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = CarTypeLimit.CONST_TABLE_NAME)
public class CarTypeLimit extends Model {
    public static final String CONST_TABLE_NAME = "crm_car_type_limit";

    @Id
    @Column(name = "id", nullable = false, length = 24)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "车型限制服务", padding = 8)
    @Comment("车型限制服务编码")
    private String id; // id

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "classify_id", referencedColumnName = "id")
    @Comment("商品分类编码")
    private Classify classify;  //商品分类

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "reg_province_id", referencedColumnName = "id")
    @Comment("省份")
    private Area regProvince; //省份

}
